<!DOCTYPE html>
<html lang='en'>

<head>
    <meta charset='UTF-8'>
    <meta http-equiv='X-UA-Compatible' content='IE=edge'>
    <meta name='viewport' content='width=device-width, initial-scale=1.0'>
    <title>工资想过万，键盘要敲烂</title>
    <style>
 
    </style>
</head>

<body>
 <input type="text">
<script>
let timeId
document.querySelector("input").oninput = function(){
  clearTimeout(timeId)
 timeId= setTimeout(()=>{
    console.log(this.value);
  },300)
}

  // let arr= 'abcdcabcd'
  // console.log(arr)
  // arr=arr.replace(/c/gi,function(item){
  //   return '<span style="color:#ff7043">C</span>'
  // })
  // document.body.innerHTML=arr

</script>
</body>

</html> 